import java.io.File;
import java.io.FileNotFoundException;
import java.util.Map;
import java.util.HashMap;
import java.util.Scanner;
public class yaN {
	Map<String, String> dict = new HashMap<String, String>();
	String word;
	
public String splitDevanagari(String word, Map<String, String> dict){
		String a = null;
		for(int i = 0; i < word.length() - 3; i++){
			String s3 = word.substring(i, i+3);
			if(s3.equals("्यु")){
				String w1 = word.substring(0, i) + "ि";
				String w2 = "उ" + word.substring(i+3);
				String w3 = word.substring(0, i) + "ी";
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
				else if(dict.containsKey(w3) && dict.containsKey(w2)){
					a = w3 + " " + w2;
					return a;
				}
			}//end if
			else if(word.substring(i, i+3).equals("्ये")){
				String w1 = word.substring(0, i) + "ि";
				String w2 = "ए" + word.substring(i+3);
				String w3 = word.substring(0, i) + "ि";
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
				else if(dict.containsKey(w3) && dict.containsKey(w2)){
					a = w3 + " " + w2;
					return a;
				}
			}//end else if
			else if(word.substring(i, i+2).equals("्व")){
				String w1 = word.substring(0, i) + "ु";
				String w3 = "अ" + word.substring(i+2);
				String w2 = word.substring(0, i) + "ू";
				if(dict.containsKey(w1) && dict.containsKey(w3)){
					a = w1 + " " + w3;
					return a;
				}//end if
				else if(dict.containsKey(w3) && dict.containsKey(w2)){
					a = w2 + " " + w3;
					return a;
				}
			}//end else if
			else if(word.substring(i, i+2).equals("्र")){
				String w1 = word.substring(0, i+1) + "रु";
				String w2 = "अ" + word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if 
			else if(word.substring(i, i+2).equals("्य")){
				String w1 = word.substring(0, i) + "ि";
				String w2 = "अ" + word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if 
		}//end for
		return null;
	}//end method

	public String split(String word, Map<String, String> dict){
		String a = splitDevanagari(word, dict);
		if (a != null)
			return a;
		for(int i = 0; i < word.length() - 2; i++){
			if(word.substring(i, i+2).equals("yu")){
				String w1 = word.substring(0, i) + "ii";
				String w2 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end if
			else if(word.substring(i, i+2).equals("ya")){
				String w1 = word.substring(0, i) + "ii";
				String w2 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+2).equals("va")){
				String w1 = word.substring(0, i) + "u";
				String w3 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w3)){
					a = w1 + " " + w3;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+3).equals("vai")){
				String w1 = word.substring(0, i) + "u";
				String w2 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if 
			else if(word.substring(i, i+3).equals("vaa")){
				String w1 = word.substring(0, i) + "u";
				String w2 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+3).equals("ava")){
				String w1 = word.substring(0, i) + "uu";
				String w2 = word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+2).equals("vi")){
				String w1 = word.substring(0, i) + "uu";
				String w2 = word.substring(i+1);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+4).equals("traa")){
				String w1 = word.substring(0, i+2);
				String w2 = word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 +  " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+4).equals("trau")){
				String w1 = word.substring(0, i+2);
				String w2 = word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
			else if(word.substring(i, i+4).equals("trii")){
				String w1 = word.substring(0, i+2);
				String w2 = word.substring(i+2);
				if(dict.containsKey(w1) && dict.containsKey(w2)){
					a = w1 + " " + w2;
					return a;
				}//end if
			}//end else if
		}//end for
		return "Word doesn't contain sandhi.";
	}//end method
}//end class
